/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UserInterface;

import GestureRecognition.Slide;
import camera.SkinBasedCamera;
import controller.SkinBasedController;
import insurface.InteractiveSurface;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;

/**
 *
 * @author Home
 */
public class PowerPointViewer extends InteractiveSurface implements Runnable {

    public int lcam;
    public int rcam;
    File f;
    JFileChooser fchose = null;

    public void setLcam(int lcam) {
        System.out.println("lcam= " + lcam);
        this.lcam = lcam;
    }

    public void setRcam(int rcam) {
        this.rcam = rcam;
    }

    public void run() {
        fchose = new JFileChooser();
        System.out.println("2222222222222222");
        Desktop dt = Desktop.getDesktop();
        System.out.println("1111111111111");

        int returnVal = fchose.showDialog(this, "Open");
        System.out.println("333333333333");
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            f = fchose.getSelectedFile();
        }
        System.out.println("444444444444");
//        try {
//         //   dt.open(f);
//            System.out.println("5555555555555");
//        } catch (IOException ex) {
//            Logger.getLogger(SetCameras.class.getName()).log(Level.SEVERE, null, ex);
//        }
        InteractiveSurface ins = new InteractiveSurface();

        SkinBasedController sbc = new SkinBasedController(lcam, rcam, this);
        control = sbc;
        Thread th = new Thread(sbc);
        th.start();
        Slide sl = new Slide();
        int[] cordinate = new int[2];
        //   System.out.println(sbc.camActive);
        while (control.camActive) {
            cordinate[0] = 1280 - getX1();
            cordinate[1] = getY1();
            sl.identifyGestureType(cordinate);
            //System.out.println("x="+cordinate[0]+" y="+cordinate[1]);
        }
    }

    public static void main(String[] args) {
        new Thread(new PowerPointViewer()).start();
    }
}
